#!/bin/sh

# 关闭正在运行的服务
echo 'stop swoole'

if ps -ef | grep -v grep | grep "elite master" > /dev/null; then
    ps aux | grep 'elite master' | grep -v grep | awk '{print $2}' | sudo xargs kill
fi

sleep 5

# 启动服务
php ./public/server.php

if ps -ef | grep -v grep | grep "elite master" > /dev/null; then
    echo "start success"
else
    echo "start fail"
fi